﻿Imports System
Imports System.IO
Imports System.Security.Cryptography
Imports System.Text

Module HMAC_MD5
    Public HMAC_Key As String = "E9E9BD0C86ECEBE62B6F21867E4A723CCA2F417D18105CB04C6EE752"
    Public Function getMessageHMACHash(ByVal messages As String) As String
        Dim myhmac As New HMACMD5(System.Text.Encoding.Unicode.GetBytes(HMAC_Key))
        Dim hashValue As Byte() = myhmac.ComputeHash(System.Text.Encoding.Unicode.GetBytes(messages))
        Dim sBuilder As New StringBuilder()
       
        For i As Integer = 0 To hashValue.Length - 1
            sBuilder.Append(hashValue(i).ToString("x2"))
        Next i

        Return sBuilder.ToString
    End Function
End Module
